/** (c) 2005-2007 Messaging Logic, All Rights Reserved. */
package org.xi8ix.jdbc;

/**
 * SQL statements can take any object as a parameter. However, if the parameter is null, the statement
 * cannot guess the correct type, and must be provided with a SQL type code in order to successfully
 * compile the SQL statement. The SimpleParameter class wraps the object and it's type in order to provide
 * unambiguous type information for a SimpleStatement.
 *
 * @author Iain Shigeoka
 * @invariant $none
 */
public class SimpleParameter {

    private Object value;
    private int type;

    /**
     * Create a simple parameter to wrap the given value, with it's corresponding SQL type.
     *
     * @param value the value to wrap
     * @param type the type defined by java.sql.Types
     */
    public SimpleParameter(Object value, int type) {
        this.value = value;
        this.type = type;
    }

    /**
     * Obtain the value wrapped by this simple parameter
     *
     * @return the parameter value
     */
    public Object getValue() {
        return value;
    }

    /**
     * Set the value wrapped by this simple parameter
     *
     * @param value the parameter value
     */
    public void setValue(Object value) {
        this.value = value;
    }

    /**
     * Obtain the SQL type.
     *
     * @return the sql type
     */
    public int getType() {
        return type;
    }

    /**
     * Set the sql type
     *
     * @param type the sql type
     */
    public void setType(int type) {
        this.type = type;
    }
}